import request from '@/utils/request'

// 用户登录
export function login(username, password) {
  return request({
    url: '/api/auth/login',
    method: 'post',
    data: {
      username,
      password
    }
  })
}

// 用户注册
export function register(data) {
  return request({
    url: '/api/auth/register',
    method: 'post',
    data
  })
}

// 退出登录
export function logout() {
  return request({
    url: '/api/auth/logout',
    method: 'post'
  })
}

// 忘记密码
export function forgotPassword(email) {
  return request({
    url: '/api/auth/forgot-password',
    method: 'post',
    data: {
      email
    }
  })
}

// 重置密码
export function resetPassword(token, password) {
  return request({
    url: '/api/auth/reset-password',
    method: 'post',
    data: {
      token,
      password
    }
  })
}

// 获取验证码
export function getVerifyCode(phone) {
  return request({
    url: `/api/auth/verifyCode/${phone}`,
    method: 'get'
  })
} 